Scripting > CxEventIF > EventQuery Object > EventQuery Methods

EventQuery Methods

The EventQuery object contains the following methods:

Note: Some of the examples in this topic use the WScript.Sleep statement, which is not recommended for use when scripting in CygNet Studio. Use TheView EventTimer instead.

CancelEventFiltering

The CancelEventFiltering method cancels the filtering of events.

Syntax

CancelEventFiltering()

Example

The following example cleans up the query after it is finished, by canceling the filtering and destroying the filter.

Sub

 

'event query is finished

EventQuery.CancelEventFiltering()

EventQuery.DestroyEventFilter(100)

 

End Sub

Back to top

ClearQueryResults

The ClearQueryResults method clears the results of a previous query and initializes the processing flags. The queries (filters) themselves are not cleared.

Syntax

ClearQueryResults()

Remark

Clearing the results of a previous query is good programming practice if multiple queries are to be performed.

It is necessary to call ClearQueryResults after creating a filter in order to run to the filter.

Example

The following example addresses clearing the query results before retrieving data from the query.

Sub

 

'query is all set up

While bIsFiltering

 

WScript.Sleep(1000)

 

'call before retrieving data

EventQuery.ClearQueryResults()

 

'retrieve data, etc.

Wend

 

End Sub

Back to top

CreateEventFilter

The CreateEventFilter method creates a new event filter thread.

Syntax

CreateEventFilter(StartTime As Date, EndTime As Date, UpdateInterval As Integer) As Boolean

Parameters

Parameter Required Description

StartTime

Yes

The earliest date/time of events to be filtered. Note that this value can either be a string in the machine-chosen date/time format (i.e. 'MM/DD/YY hh:mm:ss'for a machine using the American date/time format), or it can be a Date returned from the CDate function.

EndTime

Yes

The latest date/time of events to be filtered. Note that this value can either be a string in the machine-chosen date/time format (i.e. 'MM/DD/YY hh:mm:ss'for a machine using the American date/time format), or it can be a Date returned from the CDate function.

UpdateInterval

Yes

The periodic run interval in seconds.

Remark

It is necessary to call ClearQueryResults after creating a filter in order to run to the filter.

Example

The following example goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Sub

 

'-----------------SETUP------------------

Dim date1, date2

date1 = Date - 10

date2 = Date

Dim startDate, endDate

startDate = CDate(date1)

endDate = CDate(date2)

 

'create event filter for events between now and 10 days ago

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter(startDate, endDate, 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

'set the service-specific filters from existing XMLs (see the documentation for

'SetAudFilterAsXml/SetElsAlmFilterAsXml/SetElsFilterAsXml for examples of

'XML filters)

Dim bSetAud

bSetAud = EventQuery.SetAudFilterAsXml(g_xmlAudFilter)

EventQuery.SetAudSiteServices("CYGDEMO.AUD;CYGDEMO.AUD1")

 

Dim bSetElsAlm

bSetElsAlm = EventQuery.SetElsAlmFilterAsXml(g_xmlElsAlmFilter)

EventQuery.SetElsAlmSiteServices("CYGDEMO.ELSALM;CYGDEMO.ELSALM1")

 

Dim bSetEls

bSetEls = EventQuery.SetElsFilterAsXml(g_xmlElsFilter)

EventQuery.SetElsSiteServices("CYGDEMO.ELS;CYGDEMO.ELS1")

 

'set notification point

EventQuery.SetNotificationPoint "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT"

 

'check to see if filter has been set up correctly

Dim bIsFiltering

bIsFiltering = EventQuery.IsEventFilterFiltering()

 

'-----------------EXECUTION------------------

 

'start the filters

EventQuery.StartEventFiltering

 

'wait for query completion

Dim iCnt

iCnt = 0

Dim bDone

bDone = False

While (Not bDone)

bDone = EventQuery.IsQueryComplete()

If( Not bDone) Then

'event hasn't completed yet

iCnt = iCnt + 1

If( iCnt > 100 ) Then

bDone = True 'tired of waiting, just terminate

Else

WScript.Sleep(1000)

End if

End if

Wend

 

'-----------------RESULTS------------------

 

Dim strAudError, strElsAlmError, strElsError

Dim nSize, recKey, pvEventInfoXml, pvKeyList, iRec

 

'Aud

EventQuery.GetAudQueryError strAudError

EventQuery.GetFilteredAudListSize nSize

 

pvKeyList = ""

EventQuery.GetFilteredAudList pvKeyList

For iRec = 0 To nSize - 1

recKey = pvKeyList (iRec)

pvEventInfoXml = ""

EventQuery.GetAudEventInfoAsXml recKey, pvEventInfoXml

 

MsgBox pvEventInfoXml

Next

 

EventQuery.GetAudQueryError(strAudError)

 

'ElsAlm

EventQuery.GetElsAlmQueryError strElsAlmError

EventQuery.GetFilteredElsAlmListSize nSize

 

pvKeyList = ""

EventQuery.GetFilteredElsAlmList pvKeyList

For iRec = 0 To nSize - 1

recKey = pvKeyList (iRec)

pvEventInfoXml = ""

EventQuery.GetElsAlmEventInfoAsXml recKey, pvEventInfoXml

 

MsgBox pvEventInfoXml

Next

 

EventQuery.GetElsAlmQueryError(strElsAlmError)

 

'Els

EventQuery.GetElsQueryError strElsError

EventQuery.GetFilteredElsListSize nSize

 

pvKeyList = ""

EventQuery.GetFilteredElsList pvKeyList

For iRec = 0 To nSize - 1

recKey = pvKeyList (iRec)

pvEventInfoXml = ""

EventQuery.GetElsEventInfoAsXml recKey, pvEventInfoXml

 

MsgBox pvEventInfoXml

Next

 

EventQuery.GetElsQueryError(strElsError)

 

'event query is finished

EventQuery.CancelEventFiltering()

EventQuery.DestroyEventFilter(100)

 

End Sub

Back to top

DestroyEventFilter

The DestroyEventFilter method terminates execution of the filter thread, and waits for the specified number of seconds.

Syntax

DestroyEventFilter(TimeToWaitInSeconds As Integer) As Boolean

Parameters

Parameter Required Description

TimeToWaitInSeconds

Yes

The number of seconds to wait for the event query to terminate. This value must be within the range [1 - 100].

Remark

This method will hang for the specified number of seconds while the filter thread terminates. If the filter thread has not terminated by the time the interval has expired, this method will return false and the filter thread will continue to attempt to terminate in the background. Call this method as part of the cleanup routine after querying is finished.

Example

The following example cleans up the query after it is finished, by canceling the filtering and destroying the filter.

Sub

 

'event query is finished

EventQuery.CancelEventFiltering()

EventQuery.DestroyEventFilter(100)

 

End Sub

Back to top

FormatSiteServicePlusDbKey

The FormatSiteServicePlusDbKey method puts a Site.Service and a DbKey into the 'Site.Service+DbKey'format.

Syntax

FormatSiteServicePlusDbKey(SiteService As String, DbKey As String, SiteServiceDbKey As String) As Boolean

Parameters

Parameter Required Description

SiteService

Yes

The Site.Service to be formatted.

DbKey

Yes

The DbKey to be formatted.

SiteServiceDbKey

Yes

The return value in the 'Site.Service+DbKey'format.

Remark

This method returns false if one of the SiteService or DbKey parameters is invalid. To retrieve the constituent Site.Service and DbKey from a 'Site.Service+DbKey'string, use the ParseSiteServicePlusDbKey method.

Example

The following example formats a Site.Service and DbKey and displays the result, then parses the result back into its constituent parts, and displays them. The two outputs should be identical.

Sub

 

Dim strSiteService

strSiteService = "CYGDEMO.AUD"

 

Dim strDbKey

strDbKey = "0000006547C0000001A0000001"

 

Dim strSiteServiceDbKey

 

Dim bRet

bRet = EventQuery.FormatSiteServicePlusDbKey(strSiteService, strDbKey, strSiteServiceDbKey)

 

If (bRet) Then

MsgBox strSiteServiceDbKey

End If

 

bRet = EventQuery.ParseSiteServicePlusDbKey(strSiteServiceDbKey, strSiteService, strDbKey)

 

If (bRet) Then

MsgBox strSiteService + "+" + strDbKey

End If

 

End Sub

Back to top

GetAudEventInfoAsXml

The GetAudEventInfoAsXml method returns event information for the given AUD Site.Service and DbKey.

Syntax

GetAudEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean

Parameters

Parameter Required Description

SiteServiceDbKey

Yes

The AUD Site.Service and DbKey in the 'Site.Service+DbKey'format.

EventInfoXml

Yes

The event information for the AUD Site Service returned as a string.

Remark

After querying is complete, this method is used in conjunction with GetFilteredAudList to display the results of the query.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetAudFilterAsXml

The GetAudFilterAsXml method returns the AUD event filter as an XML string.

Syntax

GetAudFilterAsXml(XmlFilter As Variant) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string returned from this method.

Example

The following example sets the AUD event filter, then retrieves it from the query and displays it.

Sub

 

'set the service-specific filter from an existing XML (see the documentation for

'SetAudFilterAsXml for an example of an XML filter)

Dim bSetAud

bSetAud = EventQuery.SetAudFilterAsXml(g_xmlAudFilter)

 

Dim xmlAudFilter

 

If (bSetAud) Then

bGetAud = EventQuery.GetAudFilterAsXml(xmlAudFilter)

 

If (bGetAud) Then

MsgBox xmlAudFilter

End If

End If

 

End Sub

Back to top

GetAudQueryError

The GetAudQueryError method returns the last error (if any) in the AUD query.

Syntax

GetAudQueryError(Error As Variant) As Boolean

Parameters

Parameter Required Description

Error

Yes

The last error in the AUD query as a string. This value is an empty string if there is no error.

Remark

This method returns true if there is an error in the AUD query, otherwise it returns false.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetElsAlmEventInfoAsXml

The GetAudQueryError method returns event information for the given ELSALM Site.Service and DbKey.

Syntax

GetElsAlmEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean

Parameters

Parameter Required Description

SiteServiceDbKey

Yes

The ELSALM Site.Service and DbKey in the 'Site.Service+DbKey'format.

EventInfoXml

Yes

The event information for the ELSALM Site Service returned as a string.

Remark

After querying is complete, this method is used in conjunction with GetFilteredElsAlmList to display the results of the query.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetElsAlmFilterAsXml

The GetElsAlmFilterAsXml method returns the ELSALM event filter as an XML string.

Syntax

GetElsAlmFilterAsXml(XmlFilter As Variant) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string returned from this method.

Example

The following example sets the ELSALM event filter, then retrieves it from the query and displays it.

Sub

 

'set the service-specific filter from an existing XML (see the documentation for

'SetElsAlmFilterAsXml for an example of an XML filter)

Dim bSetElsAlm

bSetElsAlm = EventQuery.SetElsAlmFilterAsXml(g_xmlElsAlmFilter)

 

Dim xmlElsAlmFilter

 

If (bSetElsAlm) Then

bGetElsAlm = EventQuery.GetElsAlmFilterAsXml(xmlElsAlmFilter)

 

If (bGetElsAlm) Then

MsgBox xmlElsAlmFilter

End If

End If

 

End Sub

Back to top

GetElsAlmQueryError

The GetElsAlmQueryError method returns the last error (if any) in the ELSALM query.

Syntax

GetElsAlmQueryError(Error As Variant) As Boolean

Parameters

Parameter Required Description

Error

Yes

The last error in the ELSALM query as a string. This value is an empty string if there is no error.

Remark

This method returns true if there is an error in the ELSALM query, otherwise it returns false.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetElsEventInfoAsXml

The GetElsEventInfoAsXml method returns event information for the given ELS Site.Service and DbKey.

Syntax

GetElsEventInfoAsXml(SiteServiceDbKey As String, EventInfoXml As Variant) As Boolean

Parameters

Parameter Required Description

SiteServiceDbKey

Yes

The ELS Site.Service and DbKey in the 'Site.Service+DbKey'format.

EventInfoXml

Yes

The event information for the ELS Site Service returned as a string.

Remark

After querying is complete, this method is used in conjunction with GetFilteredElsList to display the results of the query.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetElsFilterAsXml

The GetElsFilterAsXml method returns the ELS event filter as an XML string.

Syntax

GetElsFilterAsXml(XmlFilter As Variant) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string returned from this method.

Example

The following example sets the ELS event filter, then retrieves it from the query and displays it.

Sub

 

'set the service-specific filter from an existing XML (see the documentation for

'SetElsFilterAsXml for an example of an XML filter)

Dim bSetEls

bSetEls = EventQuery.SetElsFilterAsXml(g_xmlElsFilter)

 

Dim xmlElsFilter

 

If (bSetEls) Then

bGetEls = EventQuery.GetElsFilterAsXml(xmlElsFilter)

 

If (bGetEls) Then

MsgBox xmlElsFilter

End If

End If

 

End Sub

Back to top

GetElsQueryError

The GetElsQueryError method returns the last error (if any) in the ELS query.

Syntax

GetElsQueryError(Error As Variant) As Boolean

Parameters

Parameter Required Description

Error

Yes

The last error in the ELS query as a string. This value is an empty string if there is no error.

Remark

This method returns true if there is an error in the ELS query, otherwise it returns false.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetFilteredAudList

The GetFilteredAudList method returns the list of filtered AUD events as Site.Service and DbKey pairs.

Syntax

GetFilteredAudList(SiteSvcKeyList As Array) As Boolean

Parameters

Parameter Required Description

SiteSvcKeyList

Yes

A list of Site.Service and DbKey pairs (in the 'Site.Service+DbKey'format) representing the filtered AUD events.

Remark

After querying is complete, this method is used in conjunction with GetAudEventInfoAsXml to display the results of the query.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetFilteredAudListSize

The GetFilteredAudListSize method returns the size of the filtered AUD event list as an integer

Syntax

GetFilteredAudListSize(Size As Integer) As Boolean

Parameters

Parameter Required Description

Size

Yes

The size of the filtered AUD event list.

Remark

The filtered AUD event list itself can be obtained via GetFilteredAudList.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetFilteredElsAlmList

The GetFilteredElsAlmList method returns the list of filtered ELSALM events as Site.Service and DbKey pairs.

Syntax

GetFilteredElsAlmList(SiteSvcKeyList As Array) As Boolean

Parameters

Parameter Required Description

SiteSvcKeyList

Yes

A list of Site.Service and DbKey pairs (in the 'Site.Service+DbKey'format) representing the filtered ELSALM events.

Remark

After querying is complete, this method is used in conjunction with GetElsAlmEventInfoAsXml to display the results of the query.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetFilteredElsAlmListSize

The GetFilteredElsAlmListSize method returns the size of the filtered ELSALM event list as an integer

Syntax

GetFilteredElsAlmListSize(Size As Integer) As Boolean

Parameters

Parameter Required Description

Size

Yes

The size of the filtered ELSALM event list.

Remark

The filtered ELSALM event list itself can be obtained via GetFilteredElsAlmList.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetFilteredElsList

The GetFilteredElsList method returns the list of filtered ELS events as Site.Service and DbKey pairs.

Syntax

GetFilteredElsList(SiteSvcKeyList As Array) As Boolean

Parameters

Parameter Required Description

SiteSvcKeyList

Yes

A list of Site.Service and DbKey pairs (in the 'Site.Service+DbKey'format) representing the filtered ELS events.

Remark

After querying is complete, this method is used in conjunction with GetElsEventInfoAsXml to display the results of the query.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

GetFilteredElsListSize

The GetFilteredElsListSize method returns the size of the filtered ELS event list as an integer

Syntax

GetFilteredElsListSize(Size As Integer) As Boolean

Parameters

Parameter Required Description

Size

Yes

The size of the filtered ELS event list.

Remark

The filtered ELS event list itself can be obtained via GetFilteredElsList.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

IsEventFilterFiltering

The IsEventFilterFiltering method returns true if the entire query process has been set up and is enabled to run.

Syntax

IsEventFilterFiltering() As Boolean

Remark

This method will return true after a successful call to StartEventFiltering. Once the filtering has begun, this method will only return false if the filtering has been canceled using CancelEventFiltering, or if the filter has been destroyed using DestroyEventFilter.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

IsEventFilterRunning

The IsEventFilterFiltering method returns true if the event query thread is running.

Syntax

IsEventFilterRunning() As Boolean

Remark

The event query thread is executed after an event filter is created; therefore, after an event filter is created, this method will only return false if the filter has been destroyed using DestroyEventFilter.

Example

The following example creates an event filter, checks that it is running, destroys it, and checks that it is no longer running.

Sub

 

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

Dim bRunning

bRunning = EventQuery.IsEventFilterRunning()

 

MsgBox bRunning 'should be "True"

 

EventQuery.DestroyEventFilter(100)

 

bRunning = EventQuery.IsEventFilterRunning()

 

MsgBox bRunning 'should be "False"

 

End Sub

Back to top

IsQueryComplete

The IsQueryComplete method returns true if all of the queries are no longer being executed.

Syntax

IsQueryComplete() As Boolean

Remark

This method will return true as long as any AUD, ELSALM, or ELS query is being executed. It will return false if all running queries fail when adding to the respective query cache, if the filter is destroyed using DestroyEventFilter, or if the previous query results are cleared using ClearQueryResults.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

ParseSiteServicePlusDbKey

The ParseSiteServicePlusDbKey method returns the Site.Service and DbKey elements from a 'Site.Service+DbKey'string.

Syntax

ParseSiteServicePlusDbKey(SiteServiceDbKey As String, SiteService As String, DbKey As String) As Boolean

Parameters

Parameter Required Description

SiteServiceDbKey

Yes

The string to be parsed, in the 'Site.Service+DbKey'format.

SiteService

Yes

The Site.Service parsed from SiteServiceDbKey.

DbKey

Yes

The DbKey parsed from SiteServiceDbKey.

Remark

This method returns false if one of the SiteService or DbKey parameters returned is invalid. This method does the reverse of the FormatSiteServicePlusDbKey method. To format a Site.Service and DbKey into a 'Site.Service+DbKey'string, use the FormatSiteServicePlusDbKey method.

Example

The following example formats a Site.Service and DbKey and displays the result, then parses the result back into its constituent parts, and displays them. The two outputs should be identical.

Sub

 

Dim strSiteService

strSiteService = "CYGDEMO.AUD"

 

Dim strDbKey

strDbKey = "0000006547C0000001A0000001"

 

Dim strSiteServiceDbKey

 

Dim bRet

bRet = EventQuery.FormatSiteServicePlusDbKey(strSiteService, strDbKey, strSiteServiceDbKey)

 

If (bRet) Then

MsgBox strSiteServiceDbKey

End If

 

bRet = EventQuery.ParseSiteServicePlusDbKey(strSiteServiceDbKey, strSiteService, strDbKey)

 

If (bRet) Then

MsgBox strSiteService + "+" + strDbKey

End If

 

End Sub

Back to top

SetAudFilterAsXml

The SetAudFilterAsXml method sets the AUD event filter from an XML string.

Syntax

SetAudFilterAsXml(XmlFilter As String) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string representing the AUD event filter to be set.

Remark

This method returns false if the XML filter is invalid.

The following is an example of an XML AUD event filter.

<ExportedRules ruleDataIdentifier='AUD Rules'>

<Rules enabled='true'inverted='false'op='1'name=''>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CXEVENTIF_OPID'operator='='qualifier='Case Insensitive'>

<compareItem property='AuditOpId'type='0'/>

</Rule>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='FAC'operator='='qualifier='Case Insensitive'>

<compareItem property='AudItemCat'type='0'/>

</Rule>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CXEVENTIF_FAC_E'operator='='qualifier='Case Insensitive'>

<compareItem property='AudItemId'type='0'/>

</Rule>

</Rules>

</ExportedRules>

This filter will select all AUD events for which (Audit Operation ID = "CXEVENTIF_OPID" AND Audit Item Category = "FAC" AND Audit Item ID = "CXEVENTIF_FAC_E"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of AUD XML property names, see AUD XML Properties.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

SetAudMaxCacheSize

The SetAudMaxCacheSize method sets the maximum size of the AUD query cache.

Syntax

SetAudMaxCacheSize(MaxSize As Long) As Boolean

Parameters

Parameter Required Description

MaxSize

Yes

A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000.

Remark

This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.

Example

The following example creates an event filter and sets the maximum AUD cache size to 50,000 before executing the query.

Sub

 

'create event filter

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

EventQuery.SetAudMaxCacheSize 50000

 

'finish initializing and execute query

 

End Sub

Back to top

SetAudPersistHours

The SetAudPersistHours method sets the amount of time (in hours) that the AUD query cache will persist.

Syntax

SetAudPersistHours(Hours As Integer) As Boolean

Parameters

Parameter Required Description

Hours

Yes

The number of hours the AUD query cache will persist. This value must be between 0 and 100.

Remark

This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.

Example

The following example creates an event filter and sets the AUD cache persist hours to 50 before executing the query.

Sub

 

'create event filter

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

EventQuery.SetAudPersistHours 50

 

'finish initializing and execute query

 

End Sub

Back to top

SetAudSiteServices

The SetAudSiteServices method defines the list of AUD site services for the AUD event filter.

Syntax

SetAudSiteServices(SiteServices As String) As Boolean

Parameters

Parameter Required Description

SiteServices

Yes

A semicolon-delimited list of AUD Site.Services (for example, "CYGDEMO.AUD;CYGDEMO.AUD1")

Remark

This method will only return false if a filter has not yet been created.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

SetElsAlmFilterAsXml

The SetElsAlmFilterAsXml method sets the ELSALM event filter from an XML string.

Syntax

SetElsAlmFilterAsXml(XmlFilter As String) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string representing the ELSALM event filter to be set.

Remark

This method returns false if the XML filter is invalid.

The following is an example of an XML ELSALM event filter.

<ExportedRules ruleDataIdentifier='ELSALM Event Rules'>

<Rules enabled='true'inverted='false'op='1'name=''>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CxEventIf_ElsAlmTest'operator='='qualifier='Case Insensitive'>

<compareItem property='Source'type='0'/>

</Rule>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='SET'operator='='qualifier='Case Insensitive'>

<compareItem property='Category'type='0'/>

</Rule>

</Rules>

</ExportedRules>

This filter will select all ELSALM events for which (ELS Source = "CXEVENTIF_OPID" AND ELS Category = "CONTROL"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of ELSALM XML property names, see ELSALM XML Properties.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

SetElsAlmMaxCacheSize

The SetElsAlmMaxCacheSize method sets the maximum size of the ELSALM query cache.

Syntax

SetElsAlmMaxCacheSize(MaxSize As Long) As Boolean

Parameters

Parameter Required Description

MaxSize

Yes

A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000.

Remark

This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.

Example

The following example creates an event filter and sets the maximum ELSALM cache size to 50,000 before executing the query.

Sub

 

'create event filter

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

EventQuery.SetElsAlmMaxCacheSize 50000

 

'finish initializing and execute query

 

End Sub

Back to top

SetElsAlmPersistHours

The SetElsAlmPersistHours method sets the amount of time (in hours) that the ELSALM query cache will persist.

Syntax

SetElsAlmPersistHours(Hours As Integer) As Boolean

Parameters

Parameter Required Description

Hours

Yes

The number of hours the ELSALM query cache will persist. This value must be between 0 and 100.

Remark

This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.

Example

The following example creates an event filter and sets the ELSALM cache persist hours to 50 before executing the query.

Sub

 

'create event filter

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

EventQuery.SetElsAlmPersistHours 50

 

'finish initializing and execute query

 

End Sub

Back to top

SetElsAlmSiteServices

The SetElsAlmSiteServices method defines the list of ELSALM site services for the ELSALM event filter.

Syntax

SetElsAlmSiteServices(SiteServices As String) As Boolean

Parameters

Parameter Required Description

SiteServices

Yes

A semicolon-delimited list of Site.Services (for example, "CYGDEMO.ELSALM;CYGDEMO.ELSALM1")

Remark

This method will only return false if a filter has not yet been created.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

SetElsFilterAsXml

The SetElsFilterAsXml method sets the ELS event filter from an XML string.

Syntax

SetElsFilterAsXml(XmlFilter As String) As Boolean

Parameters

Parameter Required Description

XmlFilter

Yes

The XML string representing the ELS event filter to be set.

Remark

This method returns false if the XML filter is invalid.

The following is an example of an XML ELS event filter.

<ExportedRules ruleDataIdentifier='ELS Event Rules'>

<Rules enabled='true'inverted='false'op='1'name=''>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CxEventIf_ElsTest'operator='='qualifier='Case Insensitive'>

<compareItem property='Source'type='0'/>

</Rule>

<Rule enabled='true'name=''referenceAttr='0'compareToType='0'externalData=''value='CONTROL'operator='='qualifier='Case Insensitive'>

<compareItem property='Category'type='0'/>

</Rule>

</Rules>

</ExportedRules>

This filter will select all ELS events for which (ELS Source = "CXEVENTIF_OPID" AND ELS Category = "CONTROL"). Note that the "op='1'" attribute specifies that the rules are ANDed. To OR a set of rules, use "op='0'". For a complete list of ELS XML property names, see ELS XML Properties.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

SetElsMaxCacheSize

The SetElsMaxCacheSize method sets the maximum size of the ELS query cache.

Syntax

SetElsMaxCacheSize(MaxSize As Long) As Boolean

Parameters

Parameter Required Description

MaxSize

Yes

A long integer specifying the maximum cache size. This value must be between 20,000 and 10,000,000.

Remark

This method will return false if the specified cache size is out of the range [20,000 - 10,000,000]. If this method is not used, the default maximum cache size of 20,000 records will be used.

Example

The following example creates an event filter and sets the maximum ELS cache size to 50,000 before executing the query.

Sub

 

'create event filter

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

EventQuery.SetElsMaxCacheSize 50000

 

'finish initializing and execute query

 

End Sub

Back to top

SetElsPersistHours

The SetElsPersistHours method sets the amount of time (in hours) that the ELS query cache will persist.

Syntax

SetElsPersistHours(Hours As Integer) As Boolean

Parameters

Parameter Required Description

Hours

Yes

The number of hours the ELS query cache will persist. This value must be between 0 and 100.

Remark

This method will return false if the specified number of hours is out of the range [0 - 100]. If this method is not used, the default of 24 hours will be used.

Example

The following example creates an event filter and sets the ELS cache persist hours to 50 before executing the query.

Sub

 

'create event filter

Dim bCreatedOk

bCreatedOk = EventQuery.CreateEventFilter("10/1/2010", "10/4/2010", 5)

 

'initialize the filter (this step is necessary)

EventQuery.ClearQueryResults

 

EventQuery.SetElsPersistHours 50

 

'finish initializing and execute query

 

End Sub

Back to top

SetElsSiteServices

The SetElsSiteServices method defines the list of ELS site services for the ELS event filter.

Syntax

SetElsSiteServices(SiteServices As String) As Boolean

Parameters

Parameter Required Description

SiteServices

Yes

A semicolon-delimited list of Site.Services (for example, "CYGDEMO.ELS;CYGDEMO.ELS1")

Remark

This method will only return false if a filter has not yet been created.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

SetNotificationPoint

The SetNotificationPoint method sets the CVS point which will contain a notification of when the queries have completed.

Syntax

SetNotificationPoint(Tag As String) As Boolean

Parameters

Parameter Required Description

Tag

Yes

The CVS tag of the point to be used for notifications (for example, "CYGDEMO.UIS:EVENTIF_NOTIFICATION_PT").

Remark

This method will return false if the specified tag is invalid. Note that this method does not actually create a CVS point. A CVS point with the specified tag must exist prior to starting event filtering in order for CVS notifications to succeed.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

StartEventFiltering

The StartEventFiltering method initiates event filtering on the background thread.

Syntax

StartEventFiltering() As Boolean

Remark

This method returns false if no event filter has been created.

It is necessary to call ClearQueryResults after creating a filter in order to run to the filter.

Example

See the CreateEventFilter example above, which goes through the entire process of creating a filter, setting XML filters for AUD, ELSALM, and ELS services, setting the notification point, starting the query, waiting for the query to finish, displaying the results, and cleaning up the query.

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.